package com.nickstumpos.android.GmailWidgetPlus.widget.skins;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import com.nickstumpos.android.GmailWidgetPlus.R;
import com.nickstumpos.android.GmailWidgetPlus.widget.sizes.WidgetSize;

public enum WidgetSkins implements WidgetSkin {
	TWO_BY_TWO_CLASSIC(5,
			R.layout.widgetlayout,
			R.string.classic_skin,
			WidgetSize.TWOxTWO), TWO_BY_TWO_DTGRAPHITE(5,
			R.layout.dtwidgetlayout,
			R.string.dt_graphite,
			WidgetSize.TWOxTWO,
			WidgetSize.FOURxTWO), TWO_BY_TWO_SIMPLE(4,
			R.layout.simplewidgetlayout,
			R.string.simple_skin,
			WidgetSize.TWOxTWO,
			WidgetSize.FOURxTWO), ONE_BY_ONE_LABEL(0,
			R.layout.simplewidgetlayout,
			R.string.obo_label,
			WidgetSize.ONExONE), ONE_BY_ONE_NO_LABEL(0,
			R.layout.simplewidgetlayout,
			R.string.obo_no_label,
			WidgetSize.ONExONE), FOUR_BY_ONE_SIMPLE(2,
			R.layout.simplewidgetlayoutheightone,
			R.string.simple_skin,
			WidgetSize.FOURxONE), FOUR_BY_ONE_DTGRAPHITE(2,
			R.layout.dtwidgetlayoutheightone,
			R.string.dt_graphite,
			WidgetSize.FOURxONE);

	private int					numberLabels;
	private int					layout;
	private List<WidgetSize>	supportedSizes;
	private int					nameId;

	WidgetSkins(final int numLabels,
			final int layout,
			final int nameId,
			final WidgetSize... sizes) {

		if (sizes != null) {
			this.supportedSizes = Arrays.asList(sizes);
		} else {
			this.supportedSizes = new ArrayList<WidgetSize>();
		}
		this.layout = layout;
		this.numberLabels = numLabels;
		this.nameId = nameId;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.nickstumpos.android.GmailWidgetPlus.widget.skins.WidgetSkin#getLayout
	 * ()
	 */
	@Override
	public int getLayout() {

		return this.layout;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.nickstumpos.android.GmailWidgetPlus.widget.skins.WidgetSkin#getNameId
	 * ()
	 */
	@Override
	public int getNameId() {

		return this.nameId;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @seecom.nickstumpos.android.GmailWidgetPlus.widget.skins.WidgetSkin#
	 * getSupportedSizes()
	 */
	@Override
	public List<WidgetSize> getSupportedSizes() {

		return this.supportedSizes;
	}

	@Override
	public boolean supportSize(final WidgetSize size) {

		if (this.supportedSizes.indexOf(size) > -1) {
			return true;
		}
		return false;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @seecom.nickstumpos.android.GmailWidgetPlus.widget.skins.WidgetSkin#
	 * totalShowingLabels()
	 */
	@Override
	public int totalShowingLabels() {

		return this.numberLabels;
	}
}
